import time
j=0
def b(m1, N):
    for i in range(N-1):
        for j in range(N-i-1):
            if m1[j]<m1[j+1]:
                m1[j],m1[j+1]=m1[j+1],m1[j]
def r(v):
    file=open("m1_sorted.txt","r")
    file=open("m2_reverse.txt","r")
    file=open("m3_shuffle.txt","r")
    data=file.readlines()
    return data
m1_sorted=r("m1_sorted.txt")
m2_reverse=r("m2_reverse.txt")
m3_shuffle=r("m3_shuffle.txt")
ra=len(m1_sorted)
ra2=len(m2_reverse)
ra3=len(m3_shuffle)
ts1=time.time()
b(m1_sorted,ra)
tf1=time.time()
ts2=time.time()
b(m2_reverse,ra2)
tf2=time.time()
ts3=time.time()
b(m3_shuffle,ra3)
tf3=time.time()
print("m1_sorted",round((tf1-ts1)*1000),"milliseconds")
print("m2_reverse",round((tf2-ts2)*1000),"milliseconds")
print("m3_shuffle",round((tf3-ts3)*1000),"milliseconds")  
